// app.js
App({
    request(obj){ //发起网络请求 Obj={ url, timeout, }
    return new Promise((resolve, reject)=>{
        wx.request({
            ...obj,
            complete: r => { //r-请求返回的结果
                if (r.errMsg == 'request:ok' && r.data != null) { //成功获得数据
                    resolve(r.data)
                } else { //否则，返回null
                    resolve(null)
                }
            },
        })
    })
},
})
